package org.budo.activiti.util;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author lmw
 */
public class ObjectMapperUtil {
    public static JsonNode readTree(ObjectMapper objectMapper, String content) {
        try {
            return objectMapper.readTree(content);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    public static JsonNode readTree(byte[] content) {
        try {
            return new ObjectMapper().readTree(content);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
}